
function drawReact() {
    let canvas = document.getElementById("_canvas");
    let ctx = canvas.getContext("2d");
    let engine = new Engine(ctx);
    let layer = new Layer(ctx);

    layer.create = function () {
        let drawing = new GameComponent.DrawingRect()
        layer.addObject(drawing);
    }

    engine.addLayer(layer);
    engine.run();
    return engine;
}

function drawArc() {
    let canvas = document.getElementById("_canvas");
    let ctx = canvas.getContext("2d");
    let engine = new Engine(ctx);
    let layer = new Layer(ctx);

    layer.create = function () {
        let drawing = new GameComponent.DrawingArc();
        layer.addObject(drawing);
    }

    engine.addLayer(layer);
    engine.run();
    return engine;
}

function drawArc2() {
    let canvas = document.getElementById("_canvas");
    let ctx = canvas.getContext("2d");
    let engine = new Engine(ctx);
    let layer = new Layer(ctx);

    layer.create = function () {
        let drawing = new GameComponent.DrawingArc2();
        layer.addObject(drawing);
    }

    engine.addLayer(layer);
    engine.run();
    return engine;
}

function drawArrow() {
    let canvas = document.getElementById("_canvas");
    let ctx = canvas.getContext("2d");
    let engine = new Engine(ctx);
    let layer = new Layer(ctx);

    layer.create = function () {
        let drawing = new GameComponent.DrawingArrow();
        layer.addObject(drawing);
    }

    engine.addLayer(layer);
    engine.run();
    return engine;
}

function drawingArrows() {
    let canvas = document.getElementById("_canvas");
    let ctx = canvas.getContext("2d");
    let engine = new Engine(ctx);
    let layer = new Layer(ctx);

    var drawObject;
    layer.create = function () {
        // drawObject = new GameComponent.DrawingArrow();
        // layer.addObject(drawing);
    }

    layer.update = function () {
        //当前绘画还没完成 不能重新画
        var drawing = drawObject != null && !drawObject.isCompleted();
        if (drawing) {
            return;
        }

        //进入新的绘画
        drawObject = new GameComponent.DrawingArrow();
        layer.addObject(drawObject);
    }

    engine.addLayer(layer);
    engine.run();
    return engine;
}
